package ca.tatham.scheduler.simulate;

class TaskLine {
	private final TaskDiagram m_diagram;
	private final StringBuilder m_buffer = new StringBuilder();
	private final char m_char;
	private SimulatedTask m_task;

	public TaskLine(TaskDiagram diagram, char c) {
		m_diagram = diagram;
		m_char = c;
	}

	String getLine() {
		return m_buffer.toString();
	}

	void tick() {
		m_buffer.append('.');
	}

	void unitProcessed() {
		// Log.log(this, "Unit " + m_buffer.length() + " processed");
		m_buffer.append(m_char);
		m_diagram.unit(this);
	}

	void setTask(SimulatedTask task) {
		m_task = task;
	}

	SimulatedTask getTask() {
		return m_task;
	}

}